@isTest
private class Cbl_ReturnMachineUpdateYQTest {
    static testMethod void testMethod1() {
        
        ProductStructure__c ps1=new ProductStructure__c();
        ps1.Name='仪器';
        ps1.Classify1__c='生化';
        ps1.Classify2__c='生化-设备';
        ps1.Classify3__c='仪器';
        insert ps1;
        Brand__c brand = new Brand__c(
        	BrandShortName__c = '四川迈克'
        );
        insert brand;
       Province__c province  = new Province__c();
       province.Name = '四川';

       insert province ;

         City__c city = new City__c();
       city.Province__c = province.Id;
       insert city;


         Account acc = TestUtils.createAccount();
        acc.Level__c = '三级甲等';
        acc.RecordTypeId = Utils.getRecordTypeIdByDevNameAndObjName('Dealer', 'Account');
          acc.Province__c = province.Id;
        acc.City__c = city.Id;
        insert acc;  


        Id pRT = Utils.getRecordTypeIdByDevNameAndObjName('NCProduct', 'Product__c');

     	Product__c p  = TestUtils.createInst();
        p.Name = '测试仪器';
        p.RecordTypeId = pRT;
        p.Category0__c  = '仪器';
        p.Category1__c ='生化';
        p.ProductName__c = '测试仪器';
        p.ProductStructure__c = ps1.Id;
        p.CRMBrand__c = brand.Id;
        p.NCCode__c = '10';
        p.InstrumentType__c = '维保仪器';
        insert p ;

        Equipment__c eq = new Equipment__c();
        eq.IMEINumber__c = '0001';
        eq.Product__c = p.Id;
        eq.Account__c = acc.Id;

        insert eq; 

        Return_Machine__c rm = new Return_Machine__c();
        rm.instrument__c = eq.Id ;
        rm.Type__c = '退机';

        rm.Status__c = '草案中';

        insert rm ;

        try {
             rm.Status__c = '已批准';
             update rm;
        }
        catch (Exception e) {
            
        }
        
    }
}